<template>
  <div class="swiper-root">
    <el-carousel :loading="loading" :interval="3000" type="card">
      <el-carousel-item v-for="item in swiperList" :key="'swiper' + item">
        <el-image :src="item" :fit="'cover'"></el-image>
      </el-carousel-item>
    </el-carousel>
  </div>
</template>
<script>
import { HttpGet, HttpPost } from '@/api/http'
export default {
  name: "Swiper",
  data() {
    return {
      loading: false,
      swiperList:[]
    }
  },
  created() {
    this.getSwiper()
  },
  methods: {
    async getSwiper() {
      try {
        this.loading = true
        const res = await HttpGet({ url: '/swiper/all' })
        if(res.code == 200){
          console.log(res);
          this.swiperList = res.data.map(item=>{
            return item.src
          })
          console.log(this.swiperList);
        }
      }
      finally {
        this.loading = false
      }
    }
  }
}

</script>

<style scoped>
.swiper-root {
  height: 100%;
  width: 100%;
}
>>> .el-carousel__mask{
  background: none;
}
>>> .el-carousel__container{
}
.el-image{
  width: 100%;
  border-radius: 10px;
}
</style>

